package com.paic.mhis.hcpms.quota.exportword.dao.impl;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.paic.mhis.hcpms.quota.exportword.dao.WordDataDao;
import com.paic.mhis.hcpms.quota.exportword.dto.IndicatorWordDTO;
import com.paic.mhis.hcpms.quota.exportword.dto.KpiBatchDTO;
import com.paic.mhis.hcpms.quota.exportword.dto.KpiLimitDTO;
import com.paic.pafa.biz.dao.BaseDAO;

@Component("wordDataDao")
public class WordDataDaoImpl extends BaseDAO implements WordDataDao {

	@Override
	public List<IndicatorWordDTO> queryKpiData(Map<String, String> map) {
		return (List<IndicatorWordDTO>) this._list("kpiBase.getKpi000x", map);
	}

	@Override
	public List<IndicatorWordDTO> queryYearKpiData(Map<String, String> map) {
		return (List<IndicatorWordDTO>) this._list("kpiBase.getYearKpi000x", map);
	}

	@Override
	public List<IndicatorWordDTO> queryOrgData(Map<String, String> map) {
		return (List<IndicatorWordDTO>) this._list("kpiBase.getOrgData", map);

	}

	@Override
	public List<IndicatorWordDTO> queryOneOrgData(Map<String, String> map) {

		return (List<IndicatorWordDTO>) this._list("kpiBase.getOneOrgData", map);
	}

	@Override
	public List<IndicatorWordDTO> queryOneOrgYearData(Map<String, String> map) {

		return (List<IndicatorWordDTO>) this._list("kpiBase.getOneOrgYearData", map);
	}

	@Override
	public List<IndicatorWordDTO> queryWorkDept(Map<String, String> map) {
		return (List<IndicatorWordDTO>) this._list("kpiBase.getWorkDept", map);
	}

	@Override
	public List<IndicatorWordDTO> queryOutYearData(Map<String, String> map) {
		return (List<IndicatorWordDTO>) this._list("kpiBase.getOutYearData", map);
	}

	@Override
	public List<IndicatorWordDTO> queryOneOrgOutFeeData(Map<String, String> map) {
		return (List<IndicatorWordDTO>) this._list("kpiBase.getOneOrgOutData", map);
	}

	@Override
	public BigDecimal queryMoreOrgOutData(Map<String, String> map) {

		BigDecimal temp = new BigDecimal(this._queryForObject("kpiBase.getMoreOrgOutData", map) + "");
		return temp;
	}

	@Override
	public void deleteDocRecord(Map<String, String> map) {
		this._delete("reportword.deleteDocFile", map);
	}

	@Override
	public void insertDocRecord(Map<String, String> map) {
		this._insert("reportword.insertDocFile", map);

	}

	@Override
	public List<KpiLimitDTO> queryKpiRatioLimit(Map<String, String> map) {
		List<KpiLimitDTO> list = (List<KpiLimitDTO>) this._queryForList("report.queryKpiRatioLimit", map);
		return list;
	}

	@Override
	public List<KpiBatchDTO> queryKpiBatchList(Map<String, String> map) {
		return (List<KpiBatchDTO>) this._queryForList("report.queryKpiBatch", map);
	}

	@Override
	public int updateKpiBatchNo(Map<String, String> map) {
		return this._update("report.updateKpiBatchNo", map);
	}

	@Override
	public double queryAllValue(Map<String, String> map) {
		return Double.parseDouble(this._queryForObject("kpiBase.sumAllValue", map).toString());
	}

	@Override
	public List<IndicatorWordDTO> queryRatio(Map<String, String> mapValue) {

		return (List<IndicatorWordDTO>) this._queryForList("kpiBase.queryRatio", mapValue);
	}
}
